
import modelEntity from "./modelEntity";
export default class ProgressDisplay extends modelEntity {
  constructor(options) {
    super(options);
    this.Time = options.Time;
    this.Pos = options.Pos;
    this.Progress = options.Progress;
    this.basePath = "展示进度";
    this.fileResult = [];
  }
  static newInstance() {
    return new ProgressDisplay({
      Time: null,
      Pos: null,
      Progress: null,
      basePath: "展示进度",
      fileResult: []
    })
  }
  static loadList() {
    return new Promise((resolve, reject) => {
      getApp().globalData.api.http_get(`${getApp().globalData.baseUrl}/api/prj/progressdisplay?prj=${getApp().globalData.nowPrj.GuidID}`)
        .then(
          res => {
            console.log(res);
            let list = [];
            res.forEach(x => {
              list.push(new ProgressDisplay(x));
            });
            resolve(list);
          }
        )
    })
  }
  create() {
    return new Promise((resolve, reject) => {
      window.api.http_post("/api/prj/progressdisplay?prj=" + window.nowPrj.pCode, this)
        .then(
          res => {
            let model = new ProgressDisplay(res);
            resolve(model);
          }
        )
    })
  }
  delete() {
    return new Promise((resolve, reject) => {
      window.api.http_delete("/api/prj/progressdisplay?prj=" + window.nowPrj.pCode, this)
        .then(
          res => {
            resolve(res);
          }
        )
    })
  }
  modify() {
    return new Promise((resolve, reject) => {
      window.api.http_put("/api/prj/progressdisplay?prj=" + window.nowPrj.pCode, this)
        .then(
          res => {
            let model = new ProgressDisplay(res);
            resolve(model);
          }
        )
    })
  }
}
